#ifndef DBSCAN_H
#define DBSCAN_H

#include <QObject>
#include <QHash>
#include <QTimer>
#include "Geography/berthGrid.h"
#include "spatialgrid.h"

/*********************
 * 说明：
 *
 * ********************/

class QMutex;
class SpatialGrid;

struct GridIndex
{
    qint32 rowIndex;
    qint32 colIndex;
};

class  DBSCAN : public QObject
{
    Q_OBJECT
public:
    explicit  DBSCAN(QObject *parent = 0);
    ~ DBSCAN();
    void initiate();
    //函数返回结果为簇的列表，每个簇由空间对象的列表ID组成.参数中的eps是簇半径，单位是米。minPts是最小点数。
    QList <QList<SpatialObjectBase *> > clusterSpatialObjectBase(QList <SpatialObjectBase*>
                                                 listSpatialObjectBase,double eps,quint32 minPts);

signals:
    void sigShowInfo(QString str);
public slots:

private slots:


private:
    bool getLocation(qint32 rowIndex, qint32 colIndex,double &lowerLeftLongitudeInDegree, double &lowerLeftLatidueInDegree);
    bool getGridIndex(double longitudeInDegree,double latitudeInDegree,
                      qint32 &rowIndex, qint32 &colIndex);

    SpatialGrid* (*arrayGrid)[360*GRIDS_PER_DEGREE]; //栅格分辨率为GRID_SPAN度

    qint32 colCount,rowCount;
};

#endif // DBSCAN_H
